<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Student Table</title>
</head>
<body>
	<h1>Select your available time (only one)</h1>
	<f:view>


		<!-- Creates a table based on the input times of the advisor 
(studentTimes array list found in DriverBean.java class) -->
		<!-- *Bug* the times are entered in the table twice -->

		<h:form binding="#{driverBean.tableForm}">

			<h:dataTable value="#{driverBean.selectedStudentTimes}"
				var="studentTimes" columnClasses="first, rest">
				<h:column>
					<f:facet name="header">
						<h:column>
							<h:outputText value="Day"></h:outputText>
						</h:column>
					</f:facet>
					<h:outputText value="#{studentTimes.currentDay}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:column>
							<h:outputText value="Start Time"></h:outputText>
						</h:column>
					</f:facet>
					<h:outputText value="#{studentTimes.startHr}"></h:outputText>&nbsp
					<h:outputText value="#{studentTimes.startMin }"></h:outputText>

				</h:column>

				<h:column>
					<f:facet name="header">
						<h:column>
							<h:outputText value="End Time"></h:outputText>
						</h:column>
					</f:facet>
					<h:outputText value="#{studentTimes.endHr}"></h:outputText>&nbsp
					<h:outputText value="#{studentTimes.endMin}"></h:outputText>
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:column>
							<h:outputText value="Pick a time"></h:outputText>
						</h:column>
					</f:facet>
					<h:panelGrid columns="2">
						<!-- 	button that allows the user to submit their appointment to the advisor -->
						<h:commandLink action="#{driverBean.submitStudentTime }"
							value="Select Time">
							<f:setPropertyActionListener
								target="#{driverBean.studentSelectTime}" value="#{studentTimes}" />
						</h:commandLink>




					</h:panelGrid>
				</h:column>
			</h:dataTable>

		</h:form>

		<!-- A Link that allows the student to email their advisor -->
		<a
			href="mailto:tony40@yahoo.com?cc=tony0@yahoo.com
&subject=Subject&body=body line 1%0Abody line 2">Inform
			advisor that none of the times fit your schedule</a>
		<p>

			<!-- Text formatted in the color blue at the bottom of the page -->
			<font size="3" face="verdana" color="blue"> Once your time is
				submitted an email will be sent to your advisor notifying him/her of
				your scheduled appointment. It will be up to the student to notify
				his/her advisor if the appointment needs to be changed. </font>
		</p>




	</f:view>
</body>
</html>